import 'dart:async';

main() {
  //任务流,按照先后顺序执行
  Stream.fromFutures([getData_01(), getData_02()])
      .listen((event) => {print(event)})
      .onDone(() => {print('任务执行完成')});

  print("其他任务");
  /*
      其他任务
      异步任务_01
      异步任务_02
      任务执行完成
   */
}

Future<String> getData_01() async {
  await Future.delayed(Duration(seconds: 1));
  return "异步任务_01";
}

Future<String> getData_02() async {
  await Future.delayed(Duration(seconds: 5));
  return "异步任务_02";
}
